<%@ page contentType="text/html;charset=UTF-8" isELIgnored="true" autoFlush="true"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/displaytag-el.tld" prefix="display" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/sharedfilecategory.tld" prefix="sfcat"%>
<%@ taglib uri="/WEB-INF/qautil.tld" prefix="qautil"%>
<html:link page="/sf.mrqa?action=list">共享资料</html:link>
<logic:present name="sfc" scope="request">
>><sfcat:insert resultKind="navilinks"/>
</logic:present>
<display:table name="sfs" class="qlist" id="sf" cellspacing="0" cellpadding="0">
        <display:column title="分类">
            <c:set var="sfc_id" value="${sf.mrIaskSharedFileCategory.id}"/>
            <html:link page="/sf.mrqa?action=list" paramId="catId" paramName="sfc_id">
                        <c:out value="${sf.mrIaskSharedFileCategory.name}"/>
            </html:link>
        </display:column>
    <display:column title="文件">
        <html:link page="/sf.mrqa?action=download" paramId="id" paramProperty="id" paramName="sf" title="点击下载">
            <c:out value="${sf.name}"/>
        </html:link>
    </display:column>
    <display:column property="size" title="大小" />
    <display:column title="下载次数">
            <c:out value="${sf.downloadCount}"/>
    </display:column>
    <display:column title="作者">
        <c:set var="user_id" value="${sf.mrIaskUser.id}"/>
        <c:set var="user_loginname" value="${sf.mrIaskUser.loginName}"/>
        <html:link page="/user.mrqa?action=viewuserbyother" styleId="author" paramId="id" paramName="user_id">
                    <c:out value="${user_loginname}"/>
        </html:link>
    </display:column>
    <display:column property="postDate" title="上载日期" format="{0,date,yyyy-MM-dd hh:mm}"/>    
    <c:if test="${user_session != null}">
        <c:if test="${user_session.userId == sf.mrIaskUser.id}">
        <display:column title="操作">
            <html:link page="/sf.mrqa?action=delete" paramId="id" paramName="sf" paramProperty="id" title="作者操作项">
                        删除
            </html:link>
        </display:column>
        </c:if>
        <c:if test="${user_session.userId != sf.mrIaskUser.id}">
        <c:if test="${user_session.type == '1'}">
        <display:column title="操作">
            <html:link page="/sf.mrqa?action=delete" paramId="id" paramName="sf" paramProperty="id" title="管理员操作项">
                        删除
            </html:link>
        </display:column>
        </c:if>
        </c:if>
    </c:if>
</display:table>
<logic:present name="user_session" scope="session">
<br><input type="button" value="上传资料" onclick="addSharedFile();"/>
<script type="text/javascript">
    function addSharedFile()
    {
        document.location.href = "<%=request.getContextPath()%>/sf.mrqa?action=preadd";
    }
</script>
</logic:present>
<br>
<qautil:page action="/sf.mrqa"/>
<logic:notPresent name="user_session" scope="session">
<br>登陆系统后可以上传资料
</logic:notPresent>
